{% extends "base.html" %}
{% load display static %}

{% block title %}Minijack: Live of Devices{% endblock %}

{% block stylesheets %}
  <link rel="stylesheet" type="text/css"
      href="{% static 'css/filter.css' %}">
{% endblock %}

{% block javascripts %}
  <script type="text/javascript" language="javascript"
      src="{% static 'js/devices_life.js' %}"></script>
  <script type="text/javascript" language="javascript"
      src="{% static 'js/filter.js' %}"></script>
  <script type="text/javascript" language="javascript">
    var aParams = {{ request.GET.dict|Jsonify }};
  </script>
{% endblock %}

{% block body %}
  <h1>Minijack: Life of Devices</h1>
  {% include "filter.html" %}
  <div id="suite_radio">
    <input type="radio" id="radio0" name="radio" value="0" checked="checked" />
      <label for="radio0">General Info</label>
    <input type="radio" id="radio1" name="radio" value="1" />
      <label for="radio1">Recent Tests</label>
    <input type="radio" id="radio2" name="radio" value="2" />
      <label for="radio2">Recent Notes</label>
  </div>
  <br/>
  <table id="device_table" width="100%">
    <thead>
      <tr>
        <th></th>
        <th>device_id</th>
        <th>goofy_init_time</th>
        <th>latest_test</th>
        <th>test_time</th>
        <th>serial</th>
        <th>mlb_serial</th>
        <th>hwid</th>
        <th>ips</th>
        <th>ips_time</th>
        <th>latest_ended_test</th>
        <th>ended_status</th>
        <th>c_passed</th>
        <th>c_failed</th>
        <th>mj_status</th>
        <th>latest_note_lv</th>
        <th>note_name</th>
        <th>note_text</th>
        <th>note_time</th>
      </tr>
    </thead>
    <tfoot>
      <tr>
        <th></th>
        <th>device_id</th>
        <th>goofy_init_time</th>
        <th>latest_test</th>
        <th>test_time</th>
        <th>serial</th>
        <th>mlb_serial</th>
        <th>hwid</th>
        <th>ips</th>
        <th>ips_time</th>
        <th>latest_ended_test</th>
        <th>ended_status</th>
        <th>c_passed</th>
        <th>c_failed</th>
        <th>mj_status</th>
        <th>latest_note_lv</th>
        <th>note_name</th>
        <th>note_text</th>
        <th>note_time</th>
      </tr>
    </tfoot>
    <tbody>
      {% for device in device_list %}<tr>
        <td width="20"><img src="{% static 'images/details_open.png' %}"/></td>
        <td align="center">
          <a href="{% url 'device' device.device_id %}" class="datatable_link">
            {{ device.device_id|truncatechars:18 }}
          </a>
        </td>
        <td>{{ device.goofy_init_time|slice:"5:16" }}</td>
        <td>{{ device.latest_test }}</td>
        <td>{{ device.latest_test_time|slice:"5:16" }}</td>
        <td>{{ device.serial }}</td>
        <td>{{ device.mlb_serial|truncatechars:24 }}</td>
        <td>{{ device.hwid }}</td>
        <td>{{ device.ips }}</td>
        <td>{{ device.ips_time|slice:"5:16" }}</td>
        <td>{{ device.latest_ended_test }}</td>
        <td>{{ device.latest_ended_status }}</td>
        <td align="right">{{ device.count_passed }}</td>
        <td align="right">{{ device.count_failed }}</td>
        <td>{{ device.minijack_status }}</td>
        <td>{{ device.latest_note_level }}</td>
        <td>{{ device.latest_note_name }}</td>
        <td>{{ device.latest_note_text|truncatechars:80 }}</td>
        <td>{{ device.latest_note_time|slice:"5:16" }}</td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
{% endblock %}
